<template>
	<view class="">
		
		<button @click="show">show311</button>
		
		<a href='tpoutside://pull.activity?param={}'>Open TokenPocket to authorize</a><br/>

	</view>
</template>

<script setup>
	
	// import { createPhantom, Position } from "@phantom/wallet-sdk";
	import { createPhantom, Position } from "@/node_modules/@phantom/wallet-sdk/dist/index.js";
	import {ref} from 'vue'
	
	
	const show = ()=>{
		// console.log(getApp().globalData.phantom,'getApp().globalData.phantom');
		  // 定义箭头函数
		  let a = getApp().globalData.phantom.show()
		  
		  // 调用箭头函数
		  a();
		 // phantom.show();
	}
	
	const init =  async()=>{
		try {
		      // 调用 createPhantom 方法
		      const phantomInstance = await createPhantom({
		        zIndex: 1000, // 设置钱包的 z-index
		        colorScheme: 'dark', // 设置暗黑模式
		        position: 'bottom-right', // 设置钱包位置
		      });
		      
			  console.log(getApp().globalData.phantom,'getApp().globalData.phantom');
		      // 将 Phantom 钱包实例存储在 globalData 中
		      getApp().globalData.phantom = phantomInstance;
		      
		      console.log('Phantom 钱包已初始化:', phantomInstance);
		    } catch (error) {
		      console.error('初始化 Phantom 钱包失败:', error);
		    }
		
	}
	
	init()
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
